package com.rimi.controller;

import com.rimi.bean.Menu;
import com.rimi.bean.Video;
import com.rimi.service.MenuService;
import com.rimi.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/index")
public class IndexPageController {
    @Autowired
    private MenuService menuService;
    @Autowired
    private VideoService videoService;

    @RequestMapping("/index")
    public String toIndex(Model model){

        List<Menu> menuList = menuService.getMenuList();
        List<Video> videoList = videoService.getVideoList();
        model.addAttribute("Video", videoList);
        model.addAttribute("menus", menuList);

        return "index";
    }

}
